package com.wing.cabinet.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 消息中心记录表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("cab_message_center")
public class MessageCenter extends BaseEntity<MessageCenter> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum NewsType implements IEnum<Integer> {

        /**
        * 告警
        */
        alarm(0,"告警"),
        /**
        * 领货
        */
        takedelivery(1,"领货");

        private int code;
        private String desc;

        NewsType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * day
     */
    private Integer day;

    /**
     * no
     */
    private Integer no;

    /**
     * 企业编号
     */
    private String enterpriseCode;

    /**
     * 业务id
     */
    private Long businessId;

    /**
     * 消息类型
     */
    private NewsType newsType;

    /**
    * 消息类型描述
    */
    @TableField(exist = false)
    private String newsTypeDesc;

    public String getNewsTypeDesc() {
        return newsType == null ? null : newsType.getDesc();
    }

    /**
     * 是否已读
     */
    private Boolean haveRead;

}
